using namespace std;
//Abstract class shape
#ifndef _SHAPE_H_
#define _SHAPE_H_

#include<iostream>
#include "PointH.h"
#include "ScreenH.h"
#include <fstream>

class Shape
{
	
public:


	char m_symb;
	float m_dirX, m_dirY, m_sumDirX, m_sumDirY;
	int m_prevDirX, m_prevDirY;

	void initSum(){m_sumDirX=0; m_sumDirY=0;}

	void addSumDirX (){m_sumDirX += m_dirX; return;}

	void addSumDirY (){m_sumDirY += m_dirY; return;}

	virtual	void setPos(int x, int y)=0;

	virtual void getPos(int &x, int &y)=0;

	virtual void resetPos(int x, int y){this->setPos(x,y);};

	virtual bool isInsideScreen()=0;

	void setMove(float x, float y);

	void setSymbol(char c){m_symb = c;}

	char getSymbol(){return m_symb;}

	virtual bool isDirectionsResetBorders()=0;

	virtual void draw(int drawingOption = 0, Screen * s = NULL)=0;

	void getIntegerDirection(int &x, int &y);

	void getPrevDirection(int &x, int &y);

	void getIntegerDirectionExplicitly(int &dirX, int &dirY);

	bool isDirX(float x);

	bool isDirY(float y);

	void getOriginalDirection(float &x, float &y);

	void resetDirectionX();

	void resetDirectionY();

	virtual bool isPointIn(int x, int y){return true;}; // change to abstract after implementing in Circle

	virtual string getType()const=0;

	float getDirX(){return m_dirX;}
	
	float getDirY(){return m_dirY;}

	void setDirX(float x){m_dirX = x;};

	void setDirY(float y){m_dirY = y;};

	//Serialization
	
	virtual void saveToFile(ofstream& outf, boolean binary=false) = 0;

	virtual void loadFromFile(ifstream& istr, boolean binary=false) = 0;

	void writeToBin(ofstream & outf);

	void readFromBinFile(ifstream & infile);

	void writeToText(ofstream & outf);

	void readFromText(ifstream & file);


};

#endif